import "pkl:test"

res1 = ((x: Int) -> x + 1).apply(42)
res2 = test.catch(() -> ((x: Int) -> x + 1).apply("wrong type"))

res3 = ((x: Int(isPositive)) -> x + 1).apply(42)
res4 = test.catch(() -> ((x: Int(isPositive)) -> x + 1).apply(-1))

foo {
  n = 3
  bar {
    res5 = ((str: String(length > n)) -> str).apply("abcde")
    res6 = test.catch(() -> ((str: String(length > n)) -> str).apply("abc"))
  }
}

foo2 = (foo) {
  n = 4
}

hidden isNotEmpty = (coll: Collection) -> !coll.isEmpty

res7 = ((x: List<String>(isNotEmpty), y: Set<String>(isNotEmpty)) -> x.toSet() == y).apply(List("a", "b"), Set("b", "a"))
